package com.yjb;

// redis位操作是重點不理解的地方，
public class BetyToBinary {

    public static void main(String[] args) {
        byte tByte = 'h';
        String tString = Integer.toBinaryString((tByte & 0xFF) + 0x100).substring(1);
        System.out.println("tString:" + tString);

        System.out.println("===字符串转换二进制===");
        String hello = "hello";
        byte[] helloBytes = hello.getBytes();
        for (int i = 0; i < helloBytes.length; i++) {
            String substring = Integer.toBinaryString((helloBytes[i] & 0xFF) + 0x100).substring(1);
            System.out.println("substring"+i+":" + substring);
        }
    }
}
